inscatolati - Get out of the box! :)
Useful VIM keys
[3]
- gd
When the cursor is on a local variable, it will jump to its own declaration. It will first search the local scope, and then the rest of the file.
- gD
When the cursor is on a global variable, it will jump to its own declaration. Starts searching from line 1 of the file.
- gf
Opens the file whose name is under the cursor.
- [i
Displays the first line that contains the word under the cursor. This is useful to look at the declarations of functions or variables.
- [I
Display all lines that contain the word under the cursor. This is useful to see where a local variable is used and how.
- =
Indents the highlighted block, following the rules indicated by the file type.
- }
Goes to the end of the current block.
- L
To the end of the current screen.
- *, #
Search forward/backward for the word under the cursor.
- M
Go to the middle of the screen.
- set fp?
Prints the name of the program used to format the data.
- set ft?
Shows the file type of the open buffer.
- gUiw, viwU
Upper cases/lower case the word under the cursor.
- set encoding=utf8
Tells vim that the file is utf8 encoded.
- ctrl+e, ctrl+y
Moves the current file one line upward or downward.
- diffthis
By giving this command in two different buffers, the differences between the buffers are highlighted and colored. It is equivalent to running vimdiff.
VIM modelines, comments instructing VI
[12]
Ok, to set certaion options automatically for a given file, you can simply use something like:
|
Usually, this "string" is put as a "comment" inside the file being edited. In some programming languages, the above option would look something like:
|
|
To have complete help about the above options, you can use ":help vi:" or ":help modeline".